home *** CD-ROM | disk | FTP | other *** search
- /*
- File: WindowExtensions.h
-
- Contains: Prototypes and data structures for the floating window library
-
- Written by: Dean Yu
-
- Copyright: © 1993 Apple Computer, Inc.
-
- */
-
- #ifndef __WINDOWEXTENSIONS__
- #define __WINDOWEXTENSIONS__
-
- #ifndef __WINDOWS__
- #include <Windows.h>
- #endif
-
- // Default to 68K calling conventions
-
- #ifndef USESROUTINEDESCRIPTORS
- #define USESROUTINEDESCRIPTORS 0
- #endif
-
- #ifndef __MIXEDMODE__
- #define kPascalStackBased 0
- #define STACK_ROUTINE_PARAMETER(paramCount, paramSize) 0
- #endif
-
- // Window Attributes
-
- enum WindowAttributes {
- kHasCloseBoxMask = 0x00000001,
- kHasZoomBoxMask = 0x00000002,
- kHasGrowBoxMask = 0x00000004,
- kHasModalBorderMask = 0x00000010,
- kHasThickDropShadowMask = 0x00000020,
- kHasDocumentTitlebarMask = 0x00001000,
- kHasPaletteTitlebarMask = 0x00002000,
- kHasRoundedTitlebarMask = 0x00004000,
-
- // Attribute groupings
-
- kWindowGadgetsMask = 0x0000000F,
- kWindowAdornmentsMask = 0x00000FF0,
- kWindowTitlebarMask = 0x000FF000
- };
- typedef unsigned long WindowAttributes;
-
- typedef struct WindowRecordExtensions *WindowRef;
-
- // Activate event handler prototype
-
- typedef pascal void (*ActivateHandlerProcPtr)(WindowRef theWindow, Boolean activateWindow);
-
- enum {
- uppActivateHandlerProcInfo = kPascalStackBased
- | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(WindowRef)))
- | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(Boolean)))
- };
-
- #if USESROUTINEDESCRIPTORS
- typedef UniversalProcPtr ActivateHandlerUPP;
-
- #define CallActivateHandlerProc(userRoutine, theWindow, activateWindow) \
- CallUniversalProc(userRoutine, uppActivateHandlerProcInfo, theWindow, activateWindow)
- #define NewActivateHandlerProc(userRoutine) \
- (ActivateHandlerUPP) NewRoutineDescriptor(userRoutine, uppActivateHandlerProcInfo, GetCurrentISA())
- #else
- typedef ActivateHandlerProcPtr ActivateHandlerUPP;
-
- #define CallActivateHandlerProc(userRoutine, theWindow, activateWindow) \
- (*userRoutine)(theWindow, activateWindow)
- #define NewActivateHandlerProc(userRoutine) \
- (ActivateHandlerUPP)(userRoutine)
- #endif
-
- enum {
- kActivateWindow = true,
- kDeactivateWindow = false
- };
-
- // Extensions to the WindowRecord
-
- #if powerc
- #pragma options align=mac68k
- #endif
- struct WindowRecordExtensions {
- WindowRecord theWindow;
- ActivateHandlerUPP activateHandlerProc;
- Boolean wasVisible;
- };
- #if powerc
- #pragma options align=reset
- #endif
-
- typedef struct WindowRecordExtensions WindowRecordExtensions;
-
- // 'WDEF' resource IDs.
-
- enum {
- rStandardDocumentWindowProc = 0,
- rRoundedWindowProc = 1,
- rFloatingWindowProc = 128
- };
-
- // Window procIDs and windowKinds
-
- enum {
- kStandardDocumentWindowProc = rStandardDocumentWindowProc * 16,
- kRoundedWindowProc = rRoundedWindowProc * 16,
- kFloatingWindowProc = rFloatingWindowProc * 16,
-
- kApplicationFloaterKind = 7
- };
-
- // Error codes
-
- enum {
- kUndefinedTitleBarTypeError = -1,
- kWindowNotCreatedError = -2,
- kInvalidWindowOrderingError = -3
- };
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- // Floating window routines
-
- extern pascal OSErr NewWindowReference(WindowRef *windowReference, const Rect *boundsRect, ConstStr255Param title, Boolean visible, WindowAttributes attributes, WindowRef behind, long refCon, ActivateHandlerUPP activateHandlerProc);
- extern pascal OSErr GetNewWindowReference(WindowRef *windowReference, short windResourceID, WindowRef behind, ActivateHandlerUPP activateHandlerProc);
- extern pascal void DisposeWindowReference(WindowRef windowReference);
- extern pascal void SelectReferencedWindow(WindowRef windowToSelect);
- extern pascal void HideReferencedWindow(WindowRef windowToHide);
- extern pascal void ShowReferencedWindow(WindowRef windowToShow);
- extern pascal void DragReferencedWindow(WindowRef windowToDrag, Point startPoint, const Rect *draggingBounds);
- extern pascal WindowRef FrontNonFloatingWindow(void);
- extern pascal WindowRef LastFloatingWindow(void);
- extern pascal Boolean WindowIsModal(WindowRef windowReference);
- extern pascal void DeactivateFloatersAndFirstDocumentWindow(void);
- extern pascal void ActivateFloatersAndFirstDocumentWindow(void);
- extern pascal void SuspendFloatingWindows(void);
- extern pascal void ResumeFloatingWindows(void);
- extern pascal void ValidateWindowList(void);
-
- // Getters and Setters
-
- extern pascal void GetWindowPortRect(WindowRef windowReference, Rect *portRect);
-
- extern pascal short GetWindowKind(WindowRef windowReference);
- extern pascal void SetWindowKind(WindowRef windowReference, short windowKind);
-
- extern pascal Boolean GetWindowVisible(WindowRef windowReference);
- extern pascal void SetWindowVisible(WindowRef windowReference, Boolean windowVisible);
-
- extern pascal Boolean GetWindowHilite(WindowRef windowReference);
- extern pascal void SetWindowHilite(WindowRef windowReference, Boolean windowHilite);
-
- extern pascal WindowRef GetNextWindow(WindowRef windowReference);
- extern pascal void SetNextWindow(WindowRef windowReference, WindowRef nextWindow);
-
- extern pascal RgnHandle GetContentRegion(WindowRef windowReference);
-
- extern pascal RgnHandle GetStructureRegion(WindowRef windowReference);
-
- extern pascal Handle GetWindowDefProc(WindowRef windowReference);
-
- extern pascal ActivateHandlerUPP GetActivateHandlerProc(WindowRef windowReference);
- extern pascal void SetActivateHandlerProc(WindowRef windowReference, ActivateHandlerUPP activateHandlerProc);
-
- extern pascal Boolean GetWasVisible(WindowRef windowReference);
- extern pascal void SetWasVisible(WindowRef windowReference, Boolean wasVisible);
-
- #ifdef __cplusplus
- }
- #endif
-
- #endif
-
-